<?php
// 应用公共文件
if (!function_exists('success')) {

    function success($msg = 'success', $data = [], $code = 200, $total = 0)
    {
        return json([
            'code' => $code,
            'msg' => $msg,
            'data' => $data,
            'total' => $total,
        ]);
    }
}
if (!function_exists('error')) {
    function error($msg = 'error', $data = [], $code = 401)
    {
        return json([
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ]);
    }
}
